﻿'use strict';
/**
 * launcher js
 * auth:lww
 * version:1.0
 * date:2021-01-30
 * update:2021-01-30
 */
var allScripts = new Array();
allScripts.push("utils/common.js");
allScripts.push("utils/global.js");
allScripts.push("utils/request.js");
allScripts.push("utils/service.js");
//external lib
allScripts.push("lib/md5.js");
allScripts.push("lib/aes.js");
allScripts.push("lib/jquery.js");
//model
allScripts.push("model/RoleAction.js");
allScripts.push("model/AuthInfo.js");
allScripts.push("model/MenuInfo.js");
allScripts.push("model/Dictionary.js");
//components
allScripts.push("components/Drawable.js");
allScripts.push("components/LayoutParams.js");
allScripts.push("components/FrameLayout.js");
allScripts.push("components/LinearLayout.js");
allScripts.push("components/FragmentView.js");
//widget
allScripts.push("widget/Dialog.js");
allScripts.push("widget/DialogLoadView.js");
allScripts.push("widget/DialogTipView.js");
allScripts.push("widget/DialogFrameView.js");
allScripts.push("widget/TabMenuView.js");
allScripts.push("widget/TreeView.js");
//page
allScripts.push("page/LeftNavView.js");
allScripts.push("page/MainNavView.js");
allScripts.push("page/MainPage.js");
allScripts.push("page/Router.js");
//application
allScripts.push("config/AppConfig.js");
allScripts.push("application.js");
/**
*mark script function 
*/
var launcherScripts = new Array();
function markscript(scriptName){
    console.log("loaded script:"+scriptName);
    launcherScripts.push(scriptName);
}
function isAllScriptLoaded(){
    return launcherScripts.length == allScripts.length;
}
/**
*load script function 
*/
function loadscript(oHead,url) {    
    var oScript = document.createElement("script");
    oScript.type = "text/javascript";
    oScript.src = url;
    oHead.appendChild(oScript);
}
/**
*load style function 
*/
function loadstyle(oHead,url) {   
    var oStyle = document.createElement("link");
    oStyle.rel = "stylesheet";
    oStyle.type = "text/css";
    oStyle.src = url;
    oHead.appendChild(oStyle);
}
/**
*launcher all file 
*/
function launcher(doc,scriptPath) {         
    var oHead = doc.getElementsByTagName('HEAD').item(0);    
    launcherScripts.length = 0;
    allScripts.forEach(function(item){
        loadscript(oHead,scriptPath.concat(item));
    });
}